Skip to content

Test/test gates#1356

Draft
VulnShade wants to merge 12 commits into
mainfrom
test/test-gates
Draft

Test/test gates#1356
VulnShade wants to merge 12 commits into
mainfrom
test/test-gates

Conversation

@VulnShade

Copy link
Copy Markdown

Description

Troubleshooting error in enhanced gate

Checklist

  • Tests added and all succeed
  • Regenerated mocks, etc. (make generate)
  • Linted (make lint-fix)
  • README.md updated, if user-facing
  • License file updated, if new 3rd-party dependency is introduced

nick-y-snyk and others added 12 commits June 19, 2026 13:23
Make the per-folder "Reset overrides" button in the HTML config dialog
visible and functional end-to-end.

- Show the button (drop display:none) and move it into the folder
  disclaimer banner, right-aligned, red.
- Fix JS reset bugs: key resets by folderPath instead of the compacted
  folder index, and emit a reset-only folder even when it has no other
  edits. Emit flat null for all 14 org-scope folder fields (now incl.
  preferred_org); the IDE maps null -> {value:null, changed:true}.
- Make preferred_org resettable in applyPreferredOrg: a null reset Unsets
  both user:folder:preferred_org and user:folder:org_set_by_user so the
  folder reverts to its auto-determined / global org.
- Add JS folder-reset tests, a Go unit test for the org reset, and an
  end-to-end UpdateSettings reset test.
- Document the folder-override reset contract in configuration.md and
  configuration-dialog.md.
- Regenerate config dialog HTML fixtures.
…s [IDE-1945]

Two defects stopped 'Reset overrides' from working:

1. No-op in sandboxed webview. VSCode renders the settings dialog in a
   sandboxed iframe without 'allow-modals', so window.confirm() is silently
   ignored and returns false. Both reset handlers gated their work behind
   confirm(), so the click bailed and nothing happened. Remove the confirm()
   prompts (reset is reversible and the dialog shows a disclaimer banner).

2. Incomplete reset. additional_parameters, additional_environment and
   scan_command_config are folder overrides editable in the dialog but were
   never cleared: the JS omitted them from FOLDER_RESET_FIELDS, and on the LS
   side they are processed by applyBasicFolderFields (marked handled), so the
   generic null-reset loop skipped them while their own handlers ignored a
   nil value -- making the reset unreachable. Add the three keys to
   FOLDER_RESET_FIELDS and teach applyStringField / applyStringSliceField /
   applyScanCommandConfig to Unset the override on {Changed:true, Value:nil}.

Extend the end-to-end reset test to cover the three non-scalar fields and
drop the dead win.confirm stubs / section-name formatter.
…derOverride

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- docs: update reset field count 14→17, add additional_parameters,
  additional_environment, scan_command_config to the reset field list
- docs: correct incorrect claim that scan_command_config null-reset is
  a no-op; the LS handler now honours it via unsetFolderOverride
- tests: mirror FOLDER_RESET_FIELDS in RESET_FIELDS (14→17 entries)
- tests: remove AI-style bug annotation from test name
- tests: update "14 nulls" count to "17 nulls" in DOM-driven test name
- tests: rename test to say "auto-org" not "global org"

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Remove the duplicate "clicking reset triggers a save even with no other
edits" test (already covered by the DOM-driven no-edits test above it)
and add a test asserting the dirty tracker returns to clean after a
successful reset save.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
After applyPreferredOrg unsets preferred_org and org_set_by_user,
updateFolderConfigOrg was calling SetPreferredOrgAndOrgSetByUser("",false)
which re-added both keys as {Value:""/false, Changed:true} — making
HasUserOverride return true even though the user had just reset the
overrides.

Add a guard: only normalise to empty/false when at least one of the
keys is still present (i.e. a non-reset transition). If both are
already absent the call is a no-op for resolution purposes but creates
a spurious active-override entry in the store.

Also add SettingIsLspInitialized=true and DepScanStateAggregator to the
end-to-end reset test so it exercises the production code path through
updateFolderOrgIfNeeded.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…figOrg

The else-if !currentSnap.OrgSetByUser branch was missing the same guard
added to the orgSetByUserJustChanged branch. After a reset clears both
overrides, a subsequent update changing only AutoDeterminedOrg would
trigger this branch and re-add preferred_org / org_set_by_user as
explicit {Value:""/false, Changed:true} entries, making HasUserOverride
return true again.

Apply the same guard: skip the normalisation call when both keys are
already absent. Add a regression test that seeds the exact scenario:
reset → AutoDeterminedOrg change → assert keys stay absent.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
VSCode sandboxed webviews block window.confirm() silently (no
allow-modals). Add ideBridge.confirm(message, callback) that routes
through the existing executeCommand bridge to snyk.showConfirmationDialog
in VSCode, falling back to window.confirm() in IDEs with no bridge
(JetBrains, Eclipse). Both reset handlers (section and folder override)
now gate their work behind this callback.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@CLAassistant

CLAassistant commented Jun 23, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@snyk-io

snyk-io Bot commented Jun 23, 2026

Copy link
Copy Markdown

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues
Code Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants